//
//  RequestMessage.h
//  CityYouTian
//
//  Created by Avon Xu on 16/1/29.
//  Copyright © 2016年 Avon Xu. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "AFNetworking/AFNetworking.h"
#import "SoapRequest.h"
#import "XMLDictionary.h"

#define WebServiceNameSpace @"http://tempuri.org/"

typedef void (^resultObjectBlock)(id object, NSError *error);

@class UploadDataModel;
@interface RequestManager : NSObject

@property (nonatomic,copy)resultObjectBlock resultBlock;
#pragma mark .net后台 异步请求
+(void)asyncServiceUrl:(NSString*)URL methodName:(NSString*)methodName soapMessageDict:(NSDictionary*)soapMsgDict withBlock:(resultObjectBlock)block;
#pragma mark PHP后台 异步请求
/**
 *  post请求
 *
 *  @param URL       请求URL
 *  @param paramts 参数
 *  @param block     请求后的回调
 */
+(void)postRequestURL:(NSString*)URL parameter:(id)paramts withBlock:(resultObjectBlock)block;

/**
 *  get请求
 *
 *  @param URL       请求URL
 *  @param paramts 请求参数
 *  @param block     请求后的回调
 */
+(void)getRequestURL:(NSString*)URL parameter:(id)paramts withBlock:(resultObjectBlock)block;


///上传文件(或多张照片)
+ (void)postWithURL:(NSString *)url parameter:(id)paramts formDataArray:(NSArray <UploadDataModel*> *)formDataArray withBlock:(resultObjectBlock)block;
///上传照片(单张)[ key:file(图片)文件对应的键 ]
+ (void)uploadImageWithURL:(NSString *)url parameter:(id)paramts key:(NSString*)imageKey formImage:(UIImage *)image withBlock:(resultObjectBlock)block;

@end


@interface UploadDataModel : NSObject

/**
 *  文件数据
 */
@property (nonatomic, strong) NSData *data;

/**
 *  参数名
 */
@property (nonatomic, copy) NSString *name;

/**
 *  文件名
 */
@property (nonatomic, copy) NSString *filename;

/**
 *  文件类型
 */
@property (nonatomic, copy) NSString *mimeType;

@end
